//
//  USTarotCard.m
//  us
//
//  Created by karry on 2025/5/14.
//

#import "USTarotCard.h"

@implementation USTarotCard


- (NSString *)overview{

    NSArray<NSString *> *parts = [self.answer componentsSeparatedByString:@"｜｜"];
    
    if (parts.count >= 1) {
        return parts.firstObject;
    }
    return self.answer;
}

- (NSString *)detail{
    
    NSArray<NSString *> *parts = [self.answer componentsSeparatedByString:@"｜｜"];
    if (parts.count >= 1) {
        return parts.lastObject;
    }
    return self.answer;
    
}


- (UIImage *)cardCover {
    UIImage *cover = [UIImage imageNamed:self.imageName];
    if (self.orientation == USTarotCardOrientationReversed) {
        cover = [UIImage imageWithCGImage:cover.CGImage scale:cover.scale orientation:UIImageOrientationDown];
    }
    return cover;

}



+ (NSArray *)coverList{
    return @[@"taluo_cover_0",@"taluo_cover_1",@"taluo_cover_2",@"taluo_cover_3",@"taluo_cover_4",@"taluo_cover_5"];
}


+ (UIImage *)defaultCardCover{
    
    NSString *name = USUser.user.tarotCove.length > 0 ? USUser.user.tarotCove : @"taluo_cover_0";
    
    UIImage *image = [UIImage imageNamed:name];
    
    if (!image) {
        image = [UIImage imageNamed:@"taluo_cover_0"];
    }
    return image;
    
}

@end
